package top.kent90.common.util;

import javax.print.DocFlavor;
import java.io.*;
import java.net.URL;
import java.util.Properties;

public class LoadProperties {
	private static ClassLoaderWrapper classLoaderWrapper = new ClassLoaderWrapper();

	public static String findValue(String key) throws IOException {
		//读取配置文件 
        Properties properties = new Properties();
        FileInputStream inputFile = null;
		try{  
			// 获取classes路径
			//String classPath = CommonUtil.getClassesPath();

			InputStream is = classLoaderWrapper.getResourceAsStream("config.properties");
			// 加载资源文件
			properties.load(is);
			String value = properties.getProperty(key);
			return value;
        }catch (Exception e){  
        	e.printStackTrace();  
        }finally{
        	 if(inputFile!=null)				
        		 // 关闭文件流
				inputFile.close();				
        }
		return null;
	} 
}
